<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html;charset=utf-8"%>
<%@ include file="header_teacher.jsp"%>
<!-- 以上为页头 设置head 引用样式相关信息 请勿修改  请直接修改header.jsp文件  by 小灯笼 -->
<script src="/mycms/js/jquery.min.js"></script>
<script>

$(document).ready(function(){
	//初始化
	$("#aid_repeat").hide();  //错误信息隐藏
	$("#aid_error").hide();
	//$("#submit_btn").attr("disabled","true");  //提交按钮无效
	
	
	$("#add").click(function(){
		$("#submit")
		.before("<div class='control-group'>"+
					"<div class='controls'>"+
					  	"<select name='winYear' id='winYear' class='span3 input-left-top-margins'>"+
	                        "<option value='<%=year-4 %>'>"+
	                          "<%=year-4 %>"+
	                        "</option>"+
	                        "<option value='<%=year-3 %>'>"+
	                          "<%=year-3 %>"+
	                        "</option>"+
	                       " <option value='<%=year-2 %>'>"+
	                          "<%=year-2 %>"+
	                        "</option>"+
	                        "<option value='<%=year-1 %>'>"+
	                          "<%=year-1 %>"+
	                        "</option>"+
	                        "<option value='<%=year %>' selected='selected'>"+
	                          "<%=year %>"+
	                        "</option>"+                      
	                      "</select>"+
				 		" <input type='text' name='awards' id='awards' class='span3' placeholder='获奖奖项' required>"+
					"</div>"+
				"</div>");
	});
	
	
	$("#AId").keyup(function(){
		var aid=$("#AId").val();//获取输入框的值
		//输入非数字的值
		if(isNaN(aid)){
			$("#aid_repeat").hide();  //清除重复错误提示
			$("#aid_error").show();   //显示数值错误提示
			$("#submit_btn").attr("disabled","true");  //提交按钮无效
		}
		else
		{
			$("#aid_error").hide();   //清除数字错误提示
			
			//AJAX异步请求判断是否存在重名
			$.get("/mycms/info/exist_article_"+aid,function(data){
				if(data.result=="true")
				{
					$("#aid_repeat").show();   //错误信息显示
					$("#submit_btn").attr("disabled","true");  //提交按钮无效				
				}
				else
				{
					$("#aid_repeat").hide();  //错误信息隐藏
					$("#submit_btn").removeAttr("disabled");  //提交按钮有效
				}
			});
		}
	});
});
</script>
<!-- 以下为正文 -->

<div class="container">

<div class="left-sidebar">

     <div class="row-fluid">
       <div class="span12">
         <div class="widget">
           <div class="widget-header">
             <div class="title">
               	3.研究生获优秀学位论文情况
               <span class="mini-title">
                 3
               </span>
             </div>
             <span class="tools">
               <a class="fs1" aria-hidden="true" data-icon="" data-original-title=""></a>
             </span>
           </div>
           <div class="widget-body">
           
             <form class="form-horizontal no-margin" action="submit_article" method="post">
               <div class="control-group">
                 <label class="control-label" for="stdName" >
                   	研究生姓名
                 </label>
                 <div class="controls controls-row">
                   <input class="span3" type="text" id="stdName" name="stdName" placeholder="研究生姓名" required>
                 </div>
               </div>
               <div class="control-group">
                 <label class="control-label" for="AId">
                   	论文编号
                 </label>
                 <div class="controls">
                   <input type="text" name="AId" id="AId" class="span6" placeholder="论文编号" required>
                   <span id="aid_repeat" class="badge badge-important" style="display:none">
               			论文编号存在，请重新输入
             	   </span>
                   <span id="aid_error" class="badge badge-important" style="display:none">
               			请输入数值编号
             	   </span>
                 </div>
               </div>
               <div class="control-group">
                 <label class="control-label" for="AName">
                   	论文名称
                 </label>
                 <div class="controls">
                   <input type="text" name="AName" id="AName" class="span6" placeholder="论文题目" required>
                 </div>
               </div>
                 <div class="control-group">
                 <label class="control-label" for="tutorName">
                   	导师姓名
                 </label>
                 <div class="controls">
                   <input type="text" name="tutorName" id="tutorName" class="span6" placeholder="导师姓名" required>
                 </div>
               </div>   
               
               
               <div class="control-group">
	               <div class="controls">
	               		<button id="add" class="btn btn-primary bottom-margin" type="button">
	               		<span class="fs1" aria-hidden="true" data-icon="&#xe102;"></span> 添加奖项</button>
	               </div>
               </div>
				<div class="control-group">
					<div class="controls">            
                    <%! Integer year=new Date().getYear()+1900; %>
                    <select name="winYear" id="winYear" class="span3 input-left-top-margins">
                        <option value="<%=year-4 %>" >
                          <%=year-4 %>
                        </option>
                        <option value="<%=year-3 %>">
                          <%=year-3 %>
                        </option>
                        <option value="<%=year-2 %>">
                          <%=year-2 %>
                        </option>
                        <option value="<%=year-1 %>">
                          <%=year-1 %>
                        </option>
                        <option value="<%=year %>" selected="selected">
                          <%=year %>
                        </option>                       
                      </select>
					  <input type="text" name="awards" id="awards" class="span3" placeholder="获奖奖项" required>
					</div>  
				</div>
	            <div class="form-actions no-margin" id="submit">
	              <button id="submit_btn" type="submit" class="btn btn-info pull-right">
	                	发布
	              </button>
	              <div class="clearfix">
	              </div>
	            </div>
               
             </form>
             
           </div>
         </div>
       </div>
     </div>
</div>



<!-- 以上为正文 -->

<!-- 以下为页脚 及JS相关 请勿修改 请直接修改footer.jsp文件   by 小灯笼 -->
<jsp:include page="footer.jsp" />